//
//  EVEAPIDownloader.h
//  EVE Mac Suite
//
//  Created by Vadim Lozko on 2/7/09.
//  Copyright 2009 __Vadim__CompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "EMSGeneralUtils.h"

@class EVEAPIDownloaderRequest;

@interface EVEAPIDownloader : NSObject {
	NSMutableData* receivedData;
	NSMutableArray* requestQueue;
	id delegate;
	NSURLConnection* activeConnection;
}

@property (assign) id delegate;
@property (retain) NSURLConnection* activeConnection;

+(EVEAPIDownloader*)sharedDownloader;
-(void)performAPIDownloadRequest:(EVEAPIDownloaderRequest*)request;
-(void)performDownloadWithRequest:(NSURLRequest*)request;
-(void)popQueue;
-(NSString*)postStringForUserID:(NSString*)userID 
						 apiKey:(NSString*)apiKey 
					characterID:(NSString*)characterID
					  pixelSize:(NSString*)pixelSize;
-(void)cancelDownload;
@end

@interface NSObject (AEVEAPIDownloaderDelegate)

-(void)downloadRequestDidFinishForXMLDoc:(NSXMLDocument*)document;
-(void)downloadRequestDidFailWithError:(NSError*)error;

@end